package activiti

//import base.OpenJs

/**
 * 流程解决方案 明细
 */
class ActSolutionMx {
    String taskId //环节标识 对应权限的id  同 windowConfig.stepName 一致
    String taskName //环节名称  汉字
    String isStartTask = '0' // 是否发起  1 是  0  否
    String isWriteTzTask = '0' // 是否写台账  1 是  0  否
    String formName // 审批表单
    String formXtype // 审批表单的 xtype  用于首页的待办任务
    String printAction // 打印方法名  /controlName/actionName
    String fqActionUrl // 发起环节 打开界面的 url ,用于生成Authrity 中 url

//    OpenJs openJs
    static belongsTo = [actSolution: ActSolution]
    static constraints = {
//        description nullable: true,maxSize: 4000
        isStartTask nullable: true
        isWriteTzTask nullable: true
        printAction nullable: true
        fqActionUrl nullable: true
//        openJs nullable: true
        formXtype nullable: true
    }

    transient utilsService

    def buildDomain() {
        def b = [:] + this.properties
        def param = [allowformat: true, allowprecision: false]
        b = utilsService.truncProp(this, b, param) { amap ->
            amap << ['id': this.id]
            amap << ['formShowName': openJs?.jsName + " " + openJs?.description]
        }
        b
    }

    def buildDomainList(list) {
        def rds = []
        list.each {
            def b = [:] + it.properties
            def param = [allowformat: true, allowprecision: false]
            b = utilsService.truncProp(it, b, param) { amap ->
                amap << ['id': it.id]
                amap << ['formShowName': it.openJs?.jsName + " " + it.openJs?.description]
            }
            rds << b
        }
        return rds
    }
}
